<template>
    <Form
            :form-items="formItems"
            :format-form="(form)=>{form.processDefinitionVersion=form.processDefinitionKey__selectData.version; return form}"
            :init-data-url="$baseURL.workflow + '/workflow/canstartprocess/' + $route.params.id"
    ></Form>
</template>

<script>
    import Form from '../../../../common-util/src/components/page/Form.vue'
    export default {
        components:{
            Form
        },
        data(){
            return {
                formItems:[
                    {
                        field: {
                            name: 'name'
                        },
                        element:{
                            label: '流程名称',
                            required: true
                        }
                    },
                    {
                        field: {
                            name: 'processDefinitionKey',
                            processDefinitionKey__selectData: null
                        },
                        element:{
                            type: 'select',
                            select:{
                                url: this.$baseURL.workflow + '/workflow/definition/latest/list',
                                optionProp:{
                                    value: 'key',
                                    label: 'name'
                                }
                            },
                            label: '流程定义key',
                            required: true
                        }
                    },
                    {
                        field: {
                            name: 'isUseLatestVersion'
                        },
                        element:{
                            type: 'switch',
                            label: '使用最新版本',
                            required: true
                        }
                    },
                    {
                        field: {
                            name: 'remark'
                        },
                        element:{
                            label: '描述'
                        }
                    },
                    {
                        field: {
                            name: 'version'
                        }
                    },
                    {
                        element:{
                            type: 'button',
                            button:[
                                {
                                    action: 'submit',
                                    requestMethod:'put',
                                    url: this.$baseURL.workflow + '/workflow/canstartprocess/' +this.$route.params.id,
                                    label: '保存'
                                },
                                {
                                    action: 'reset',
                                    label: '重置',
                                    type: 'default'
                                }
                            ]
                        }
                    }
                ]
            }
        },
        mounted(){
        },
        methods:{
        }
    }
</script>

<style scoped>

</style>